#ifndef ESP32_BASE_H
#define ESP32_BASE_H

#define KEY_PIN           35
#define KEY_BUTTON_L       0
#define KEY_BUTTON_R       3
#define KEY_BUTTON_U       1
#define KEY_BUTTON_D       2
#define KEY_BUTTON_M       4

typedef void (*press_btn_t)(int);
typedef void (*longs_btn_t)(int);

class ESP32Base
{
private:
    press_btn_t _custom_press = nullptr;
    longs_btn_t _custom_longs = nullptr;

    bool auto_cfg();
    void smart_cfg();
    void key_update();

public:
    void press_btn_cb(press_btn_t press_fn);
    void longs_btn_cb(longs_btn_t longs_fn);

    void init();
    void routine();
};

#endif